package com.wntms.ywa.web;


import com.wntms.ywa.pojo.Modify;
import com.wntms.ywa.service.ModifyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/modify")
//解决跨域问题
//@CrossOrigin
public class ModifyController {
    @Autowired
    private ModifyService modifyService;

//    修改
    @PutMapping("/updateByEntity")
    public String updateModify(@RequestBody Modify modify){
        modifyService.updateCustomerIn(modify);
        modifyService.updateFreightContract(modify);
        modifyService.updateCustomerInformation(modify);
        modifyService.updateFreightContract(modify);
        modifyService.updateFreightInformation(modify);
        System.out.println("修改成功");
        return "OK";
    }
    @GetMapping("/user/{id}")
    public Modify find(@PathVariable Integer id){
       return modifyService.find(id);
    }
}
